package 网络编程项目.login.utiles;


import com.google.gson.Gson;
import 网络编程项目.login.entity.User;
import 网络编程项目.pojo.Message;

public class JsonUtil {
  private static Gson gson = new Gson();

  public static String UserToString(User user) {
    String str = gson.toJson(user);
    return str;
  }

  public static User StringToUser(String str) {
    User user = gson.fromJson(str, User.class);
    return user;
  }

  public static String MessageToString(Message message) {
    String str = gson.toJson(message);
    return str;
  }

  public static Message StringToMessage(String str) {
    Message message = gson.fromJson(str, Message.class);
    return message;
  }
}
